package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.SupplierBean;
import com.project.service.ISupplierServiceRE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("supplier")
public class ISupplierController {
    @Autowired
    private ISupplierServiceRE supplierService;

    /**
     * 添加供应商退货订单
     *
     * @param supplierInfoId 供货信息批次id
     * @param reason         退货原因
     * @return 是否添加成功
     */
    @RequestMapping("addSupplierReturnOrder")
    Boolean addSupplierReturnOrder(String supplierInfoId, String reason) {

        return supplierService.addSupplierReturnOrder(supplierInfoId, reason);

    }

    /**
     * 修改供应商退货订单的状态
     *
     * @param supplierReturnId 供应商退货订单编号
     * @param status           供货状态
     * @return 是否供货成功
     */
    /**
     * 修改供应商退货订单的状态
     *
     * @param supplierReturnId 供应商退货订单编号
     * @param status           供货状态
     * @return 是否供货成功
     */
    @RequestMapping(value = "/updateSupplierStatus/{supplierReturnId}/{status}")
    Boolean updateSupplierStatus(@PathVariable("supplierReturnId")String supplierReturnId,@PathVariable("status") int status) {
        return supplierService.updateSupplierStatus(supplierReturnId, status);

    }

    /**
     * 动态分页查询
     * @param pageNO    页码
     * @return  分页对象
     */
    @RequestMapping("findSupplierBean")
    public IPage<SupplierBean> findSupplierBean(int pageNO){
        return supplierService.findSupplierBean(pageNO);
    }

}
